<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

jimport( 'joomla.application.component.controller' );

/**
 * @package		Joomla
 * @subpackage	Config
 */
class FarmControllerBase extends JController
{
	function __construct()
	{
		JRequest::setVar('view', 'base');
		JRequest::setVar( 'layout', JRequest::getWord('task'));
		parent::__construct();
	}

	public function field()
	{
		JRequest::setVar('tmpl', 'component');
		parent::display();
	}
	
	public function saveField()
	{
		$tField = JTable::getInstance('field', 'Table');
		if ($tField->save($_POST)) die('1');
		else die($tField->getError());
	}
	
	public function flist()
	{
		parent::display();
	}
	
	public function obser()
	{
		JRequest::setVar('tmpl', 'component');
		parent::display();
	}
	
	public function saveObser()
	{
		$tObser = JTable::getInstance('obser', 'Table');
		if ($tObser->save($_POST)) die('1');
		else die($tObser->getError());
	}
	
	public function olist()
	{
		parent::display();
	}
	
	public function plant()
	{
		JRequest::setVar('tmpl', 'component');
		parent::display();
	}
	
	public function savePlant()
	{
		$tPlant = JTable::getInstance('plant', 'Table');
		if ($tPlant->save($_POST)) die('1');
		else die($tPlant->getError());
	}
	
	public function plist()
	{
		parent::display();
	}
	
	public function disease()
	{
		JRequest::setVar('tmpl', 'component');
		parent::display();
	}
	
	public function saveDisease()
	{
		$tDisease = JTable::getInstance('disease', 'Table');
		if ($tDisease->save($_POST)) die('1');
		else die($tDisease->getError());
	}
	
	public function dlist()
	{
		parent::display();
	}
	
	public function pesticide()
	{
		JRequest::setVar('tmpl', 'component');
		parent::display();
	}
	
	public function savePesticide()
	{
		$tPesticide = JTable::getInstance('pesticide', 'Table');
		if ($tPesticide->save($_POST)) die('1');
		else die($tPesticide->getError());
	}
	
	public function pelist()
	{
		parent::display();
	}
	
	public function manure()
	{
		JRequest::setVar('tmpl', 'component');
		parent::display();
	}
	
	public function saveManure()
	{
		$tManure = JTable::getInstance('manure', 'Table');
		if ($tManure->save($_POST)) die('1');
		else die($tManure->getError());
	}
	
	public function mlist()
	{
		parent::display();
	}
}